package com.houmeiyuan.huiguniang.modles.dao;

import com.houmeiyuan.huiguniang.modles.domain.Address;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Repository
public interface AddressDao {
    /* select * from address where  openId=#{openId} */

    public Address fetchByAddressId(Map<String,Object> mp);

   /* select * from address where  openId=#{openId} */
    public List fetchAll(Map<String,Object> mp);

   /*insert into address (openId,receiver,phone,province,city,country,street,detail)values
 (#{address.openId},#{address.receiver},#{address.phone},#{address.province},#{address.city},#{address.country},#{address.street},#{address.detail})*/
   @Transactional
    public Integer addAddress(@Param("address") Address address);

   /*   delete from `address` where id=#{id}*/
   @Transactional
    public Integer deleteAddress(@Param("id")Integer id);

    Integer update(Address address);
}
